package com.eastfair.pay.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.core.base.entity.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

/**
 * <p>
 * 实体类
 * 收款账户
 * </p>
 *
 * @author clm
 * @since 2023-02-22
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("pay_collection_account")
@ApiModel(value = "CollectionAccount", description = "收款账户")
@AllArgsConstructor
public class CollectionAccount extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 是否启用：1是；0否
     */
    @ApiModelProperty(value = "是否启用：1是；0否")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用：1是；0否")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 收款单位
     */
    @ApiModelProperty(value = "收款单位")
    @Size(max = 255, message = "收款单位长度不能超过255")
    @TableField(value = "company_name", condition = LIKE)
    @Excel(name = "收款单位")
    private String companyName;

    /**
     * 商户类型(MERCHANT_TYPE)
     * {@link com.eastfair.pay.enums.CompanyAccountTypeEnum}
     */
    @ApiModelProperty(value = "商户类型(MERCHANT_TYPE)")
    @Size(max = 255, message = "商户类型(MERCHANT_TYPE)长度不能超过255")
    @TableField(value = "company_account_type", condition = LIKE)
    @Excel(name = "商户类型(MERCHANT_TYPE)")
    private String companyAccountType;

    /**
     * 商户号
     */
    @ApiModelProperty(value = "商户号")
    @Size(max = 255, message = "商户号长度不能超过255")
    @TableField(value = "merchant_num", condition = LIKE)
    @Excel(name = "商户号")
    private String merchantNum;

    /**
     * 开户行
     */
    @ApiModelProperty(value = "开户行")
    @Size(max = 255, message = "开户行长度不能超过255")
    @TableField(value = "bank", condition = LIKE)
    @Excel(name = "开户行")
    private String bank;

    /**
     * 银行卡号
     */
    @ApiModelProperty(value = "银行卡号")
    @TableField(value = "bankcard_num")
    @Excel(name = "银行卡号")
    private String bankcardNum;

    /**
     * 有效开始时间
     */
    @ApiModelProperty(value = "有效开始时间")
    @TableField(value = "valid_start_time")
    @Excel(name = "有效开始时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime validStartTime;

    /**
     * 有效结束时间
     */
    @ApiModelProperty(value = "有效结束时间")
    @TableField(value = "valid_end_time")
    @Excel(name = "有效结束时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime validEndTime;

    /**
     * 有效类型(VALID_TYPE)
     */
    @ApiModelProperty(value = "有效类型(VALID_TYPE)")
    @Size(max = 255, message = "有效类型(VALID_TYPE)长度不能超过255")
    @TableField(value = "valid_type", condition = LIKE)
    @Excel(name = "有效类型(VALID_TYPE)")
    private String validType;


    @Builder
    public CollectionAccount(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime,
                             Integer isEnabled, Integer isDeleted, Long projectId, Long subsystemId, Long tenantId,
                             String companyName, String companyAccountType, String merchantNum, String bank, String bankcardNum, String validType, LocalDateTime validStartTime, LocalDateTime validEndTime) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.tenantId = tenantId;
        this.companyName = companyName;
        this.companyAccountType = companyAccountType;
        this.merchantNum = merchantNum;
        this.bank = bank;
        this.bankcardNum = bankcardNum;
        this.validType = validType;
        this.validStartTime = validStartTime;
        this.validEndTime = validEndTime;
    }

}
